Leicester City pulled six points clear of the Premier League relegation zone as Islam Slimani's header ended West Ham United's three-match winning run.